<?php 

class User extends CFormModel {

	
	public $username;
	public $email;
public function search()
{
	// Warning: Please modify the following code to remove attributes that
	// should not be searched.

	$criteria=new CDbCriteria;

	$criteria->compare('username',$this->username,true);

	$criteria->compare('email',$this->email,true);

	return new CActiveDataProvider(get_class($this), array(
			'criteria'=>$criteria,
			'sort'=>array(
					'defaultOrder'=>'username ASC',
			),
			'pagination'=>array(
					'pageSize'=>5
			),
	));
}

public function searchSql(){
	Yii::getLogger()->log('searchSQL','error');
	$count=Yii::app()->db->createCommand('SELECT count(*) FROM user')->queryScalar();
	$sql='SELECT username,email FROM user';
	$dataProvider=new CSqlDataProvider($sql, array(
			'totalItemCount'=>$count,			
			'pagination'=>array(
					'pageSize'=>5,
			),
	));
	return $dataProvider;
}
}
?>